<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
    </head>
    <body>
            <button id="s">开始</button>
            <button id="e">结束</button>
            <h1 id="t">开始抽奖吧</h1>
        <script>
            var tag=document.getElementById('t');
            var s=document.getElementById('s');
            var e=document.getElementById('e');
            var timer;
            var list=['1号','2号','3号','4号','5号','6号','7号','8号','9号'];
            console.log(list[0]);
            console.log(list.length);
            s.onclick=function(){
                clearInterval(timer);
                timer=setInterval(function(){
                    var n=parseInt(Math.random()*list.length);
                    tag.innerHTML=list[n]
                },100)
            }
            e.onclick=function(){
                clearInterval(timer);
            }
        </script>
    </body>
</html>